﻿@model IEnumerable<WI.CandidateManager.Common.Data.Entities.Attachment>

@{
    ViewBag.Title = "Attachment List";
}

<h2>Attachment List</h2>

<table class="bordered">
    <tr>
        <th>
            Download
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FileName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Resources.Common.CommonButtonDelete
        </th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td class="Center column-detail">
                @Html.ActionLink("Download", "FileDownload", new { area = "", attachmentId = item.Id }, new { @class = "common-btn BlueColor" })
            </td>
            <td>
               @Html.DisplayFor(modelItem => item.FileName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Description)
            </td>
            <td class="Center column-delete">
                @Html.ActionLink(@Resources.Common.CommonButtonDelete, "Delete", new { area = "", attachmentId = item.Id, entityId = item.EntityBase.Id, returnUrl = ViewBag.ReturnUrl }, new { @class = "common-btn RedColor" })
            </td>
        </tr>
    }

</table>

<h2>Upload new Attachment</h2>

@using (Html.BeginForm("Upload", "Attachment", new { area = "", entityId = ViewBag.EntityId, returnUrl = ViewBag.ReturnUrl },
    FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <div class="fileupload-editor">
        <div>
            <input type="file" name ="fileUpload"/>
        </div>
        <div>
            <input type="text" name ="description" placeholder="Enter description"/>
        </div>
    </div>
    <p>
        @Html.ActionLink(@Resources.Common.CommonButtonBack, "GoBack", new { area = "", returnUrl = ViewBag.ReturnUrl },new { @class = "common-btn-large BlueColor" }) <input type="submit" value=@Resources.Common.CommonButtonSave class="common-btn-large BlueColor"/>
    </p>
}
